import java.util.Arrays;

public class work4 {
 //   给定一个整型数组, 实现冒泡排序(升序排序)
    public static void sort(int[] array){
        int x;
        for (int k = 0; k < array.length - 1; k++) {
            for (int i = 0; i < array.length - 1 - k; i++) {
                int j = i + 1;
                if (array[i] > array[j]) {
                    x = array[i];
                    array[i] = array[j];
                    array[j] = x;
                }

            }
        }
    }

    public static void main(String[] args) {
        int[] array = {1,9,4,2,6,5};
        sort(array);
        System.out.println(Arrays.toString(array));
    }

}
